<%-- 
    Document   : w_displayRevenuebydate
    Created on : Nov 17, 2013, 9:40:51 PM
    Author     : Trang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="model.Role"%>
<%@page import="model.Staff"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="http://displaytag.sf.net" prefix="display" %>

<!DOCTYPE html>
<%
    Staff staff = (Staff) session.getAttribute("staff");

    if (staff == null) {
        response.sendRedirect(request.getContextPath() + "/Administration");
    }  else {
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Revenue Report</title>
        <link href="<%= request.getContextPath()%>/css/style_for_page.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_warehousing.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_menu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_addtion.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/adMenu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/tHeaderFooter.css" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css" />

        <script>
            $(function() {
                $('#start').datepicker();
                $('#end').datepicker();
            });
        </script>
    </head>
    <style type="text/css">
        .tableRevenue2 table{
            width: 99%;
            margin-left: 5px;
            border:1px solid black;
            border-collapse:collapse;
        }
        .tableRevenue2 table tbody td{
            border-width:1px;border-color:black;border-style:solid;
            height: 20px;
            text-align: center;

        }
        .tableRevenue2 table thead th{
            border-width:1px;border-color:black;border-style:solid;

            font-weight: bold;
            font-size: 16px;font-family: tahoma;
        }
    </style>
    <body style="background-color: lightsteelblue;">
        <% int i = 0;%>
        <div class="contentbg">
            <div class="content">
                <div id="reportheader" style="margin-left: 10px; width: 500px;">
                    <h3><b>COMPUTER PRODUCT RETAILER</b></h3>
                    <p><b>23 Nguyen Trai - Thanh Xuan - Ha Noi</b></p>
                    <p><b>0982396012/0914555444</b></p>
                </div>
                <div id="reportheader">
                    <div style="margin: auto;  ">
                        <h2 style="text-align: center;  "><s:property value="title"/></h2>    
                        <p style="text-align: center;  "><b><i><s:property value="date"/></b></i></p> 
                    </div>
                </div>
                <div class="content2" style="min-height: 300px;">  
                    <%
                        Integer result = (Integer) session.getAttribute("result");

                        if (result == 1) {
                    %>
                    <div class="tableRevenue2">  

                        <table>
                            <thead>
                                <tr>                  
                                    <th style="width:  60px;"> No </th> 
                                    <th>Create Date</th>
                                    <th>Customer Name</th>
                                    <th>Staff Name</th>
                                    <th style="width:  160px;">Total Quantity</th>
                                    <th style="width:  130px;">Total Amount ($)</th>  
                                </tr>
                            </thead>
                            <tbody>

                            <form name="fom" method="post" > 
                                <s:iterator value="issues">
                                    <% i++;%>
                                    <tr> 
                                        <td><%out.print(i);%></td>
                                        <td><s:property value="createTime"/></td>
                                        <td><s:property value="order.customer.firstName+' '+order.customer.lastName"/></td>
                                        <td><s:property value="staff.firstname +' 'staff.lastname"/></td>
                                        <td><s:property value="order.totalQuantity"/></td>  
                                        <td style="text-align: right;"><s:property value="order.totalAmount + ' $'"/></td>                      
                                    </tr>       
                                </s:iterator> 
                            </form>
                            </tbody>
                        </table>
                        <div style="margin: auto;width: 1024px;">
                            <table style="float: right; border-color: white;">
                                <tr>
                                    <td style="float: left;border-color: white;"><b><i>Total Revenue</i></b></td>
                                    <td style="float: right;border-color: white;"><b><s:property value="totalAmount + ' $'"/></b></td>
                                </tr>                     
                            </table>
                        </div>
                        <%} else {%>
                        <div class="tableRevenue2">  
                            <table>
                                <thead>
                                    <tr>
                                        <th style="width:  60px;"> No </th> 
                                        <th>Product Code</th>
                                        <th>Product Name</th>
                                        <th>Brand</th>
                                        <th>Unit Price ($)</th>
                                        <th style="width:  160px;">Total Quantity</th>
                                        <th style="width:  130px;">Total Price ($)</th>  
                                    </tr>
                                </thead>
                                <tbody>

                                <form name="fom" method="post"> 

                                    <s:iterator value="revenues">
                                        <% i++;%>
                                        <tr> 
                                            <td><%out.print(i);%></td>
                                            <td><s:property value="product.code"/></td>
                                            <td><s:property value="product.name"/></td>
                                            <td><s:property value="product.brand"/></td>
                                            <td><s:property value="price"/></td>
                                            <td><s:property value="totalQuantity"/></td>
                                            <td style="text-align: right;"><s:property value="totalPrice"/></td>                    
                                        </tr>       
                                    </s:iterator> 
                                </form>
                                </tbody>
                            </table>
                            <div style="margin: auto;width: 1024px;">
                                <table style="float: right; border-color: white;">
                                    <tr>
                                        <td style="float: left;border-color: white;"><b><i>Total Revenue</i></b></td>
                                        <td style="float: right;border-color: white;"><b><s:property value="totalAmount + ' $'"/></b></td>
                                    </tr>                     
                                </table>
                            </div>
                        </div>
                        <%}%>
                    </div>


                </div>   
            </div>
            <footer>
                <div id="footer">
                    <%@include file="/include/iFooter.jsp" %>
                </div>    
            </footer>
    </body>
</html>
<%
    }
%>
